package com.lengxf.pay.common.bean;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.Map;

@Data
@Accessors(chain = true)
public class CallBackParam {

    private Map<String, String> headerMap;

    private String body;

    private Map<String, String[]> parameterMap;

    private String queryString;

    public Map<String, String> toSignleParameterMap() {
        Map<String, String> map = new HashMap<>();
        parameterMap.forEach((k, v) -> map.put(k, v[0]));
        return map;
    }

    public String getHeaderValue(String headerName) {
        return headerMap.getOrDefault(headerName, StrUtil.EMPTY);
    }

}
